home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 025a / gsdb25.zip / ADDENDUM.001 next >
Text File  |  1991-08-03  |  66KB  |  2,018 lines

  1.  
  2.  
  3.  
  4.                                                                                  Addendum
  5.                                                                                  ════════
  6.           
  7.  
  8.                                CHANGES and ADDITIONS to GS_DBASE
  9.  
  10.          1.  GS_DATE:
  11.  
  12.          The GS_Date unit was added to properly handle the treatment of dates in
  13.          calculations.  The value used to store a date is a longint which will contain
  14.          the Julian Date.  This value contains the number of days between the date and
  15.          March 1, 0000.  This type of storage simplifies using math with dates and
  16.          conversion between date formats.  Also, dBase uses this format to work with
  17.          dates, and even stores this value in index files using a date as the index.
  18.  
  19.             Acknowledgements:
  20.  
  21.                 An astronomers' Julian day number is a calendar system which is useful
  22.                 over a very large span of time.  (January 1, 1988 A.D. is 2,447,162 in
  23.                 this system.)  The mathematics of these procedures originally restricted
  24.                 the valid range to March 1, 0000 through February 28, 4000.  The update
  25.                 by Carley Phillips changes the valid end date to December 31, 65535.
  26.  
  27.                 The basic algorithms are based on those contained in the COLLECTED
  28.                 ALGORITHMS from Communications of the ACM, algorithm number 199,
  29.                 originally submitted by Robert G. Tantzen in the August, 1963 issue
  30.                 (Volume 6, Number 8).  Note that these algorithms do not take into
  31.                 account that years divisible by 4000 are NOT leap years.  Therefore the
  32.                 calculations are only valid until 02-28-4000.  These procedures were
  33.                 modified by Carley Phillips (76630,3312) to provide a mathematically
  34.                 valid range of 03-01-0000 through 12-31-65535.
  35.  
  36.                 The main part of Tantzen's original algorithm depends on treating
  37.                 January and February as the last months of the preceding year.  Then,
  38.                 one can look at a series of four years (for example, 3-1-84 through
  39.                 2-29-88) in which the last day will be either the 1460th or the 1461st
  40.                 day depending on whether the 4-year series ended in a leap day.
  41.  
  42.                 By assigning a longint julian date, computing differences between
  43.                 dates, adding days to an existing date, and other mathematical actions
  44.                 become much easier.
  45.  
  46.  
  47.             Units used are:
  48.  
  49.                 Dos                           Turbo Pascal unit called to get the
  50.                                               current date.
  51.  
  52.             Types/Constants/Variables used are:
  53.  
  54.                 GS_Date_Century               Variable boolean holds year format flag.
  55.                                               If true, year will be displayed MM/DD/YYYY,
  56.                                               otherwise as MM/DD/YY.
  57.  
  58.                 GS_Date_JulInv                Constant value for an invalid date.
  59.  
  60.                 GS_Date_StrTyp                Type for date string.
  61.           
  62.           
  63.                                               -1-                                 GS_Date
  64.  
  65.  
  66.  
  67.          Griffin Solutions
  68.          ═════════════════
  69.  
  70.                 GS_Date_ValTyp                Type for longint date.
  71.  
  72.             Procedures/Functions used are:
  73.  
  74.                 GS_Date_Curr                  Function returns the current date as a
  75.                                               longint value.
  76.  
  77.                 GS_Date_DBStor                Function converts longint to YYYYMMDD.
  78.  
  79.                 GS_Date_Jul2MDY               Procedure converts longint Julian Date
  80.                                               to month, day, year word values.
  81.  
  82.                 GS_Date_Juln                  Function converts string date to longint.
  83.  
  84.                 GS_Date_MDY2Jul               Function converts numeric month, day, and
  85.                                               year to longint Julian Date.
  86.  
  87.  
  88.             GS_Date Interface:
  89.  
  90.                 uses
  91.                    Dos;
  92.  
  93.                 const
  94.                    GS_Date_JulInv  =  -1;        {constant for invalid Julian day}
  95.  
  96.                 type
  97.                    GS_Date_StrTyp  = string[10];
  98.                    GS_Date_ValTyp  = longint;
  99.  
  100.                 var
  101.                    GS_Date_Century : boolean;
  102.  
  103.                 function  GS_Date_Curr : GS_Date_ValTyp;
  104.                 function  GS_Date_DBStor(nv : GS_Date_ValTyp) : GS_Date_StrTyp;
  105.                 function  GS_Date_View(nv : GS_Date_ValTyp) : GS_Date_StrTyp;
  106.                 function  GS_Date_Juln(sdate : GS_Date_StrTyp) : GS_Date_ValTyp;
  107.                 function  GS_Date_MDY2Jul(month, day, year : word) : GS_Date_ValTyp;
  108.                 procedure GS_Date_Jul2MDY(jul : GS_Date_ValTyp;
  109.                                           var month,day,year : word);
  110.  
  111.             Sample program:
  112.  
  113.                 The sample program, DB_Xpl15.PAS, demonstrates the features of this unit.
  114.                 Try the program both with GS_Date_Century true and false to see how the
  115.                 format of the date field changes.  GS_Date_Century defaults to false.
  116.  
  117.                 The program begins by loading the current date into CurDateVal
  118.                 (CurDateVal := GS_Date_Curr).  It then displays the date (Write('Current
  119.                 date is: ',GS_Date_View(CurDateVal))).  The numeric value is also written
  120.                 for comparison.
  121.  
  122.                 A loop is processed that will continue until the date the user types is
  123.                 the current date.  Note the date comparison is numeric, so the format
  124.  
  125.  
  126.          GS_Date                                 -2-     
  127.  
  128.  
  129.  
  130.                                                                                  Addendum
  131.                                                                                  ════════
  132.           
  133.                 used to enter the date may be different.  Try using YYYYMMDD as well as
  134.                 MM/DD/YY (or MM/DD/YYYY) to enter a date.
  135.  
  136.                 In the loop, the date is read and validated in Date_Read:
  137.                     jul := GS_Date_Juln(t);
  138.                     if jul <> GS_Date_JulInv then OkDate := true else OkDate := false;
  139.  
  140.                 The date is then displayed in dBase format and "view" format:
  141.                     Writeln('Date in dBase storage format is: ',
  142.                               GS_Date_DBStor(RecDateVal));
  143.                     Writeln('Date shown in "view" format is:  ',
  144.                               GS_Date_View(RecDateVal));
  145.  
  146.                 Next, the use of math with dates is demonstrated:
  147.                     Writeln('Days between today and record date = ',
  148.                               CurDateVal-RecDateVal:6);
  149.                     Writeln('90 days after record date is: ',
  150.                               GS_Date_View(RecDateVal+90));
  151.  
  152.                 Finally, access to and manipulation of month, day, and year is
  153.                 demonstrated:
  154.                     GS_Date_Jul2MDY(RecDateVal,mm,dd,yy);
  155.                     WrkDateVal := GS_Date_MDY2Jul(1,1,yy);
  156.                     Writeln('Days since Jan 1 are: ',RecDateVal-WrkDateVal);
  157.  
  158.                 This demonstration shows how to easily work with date fields.  Try your
  159.                 own ideas to change this program to test how much easier it is to treat
  160.                 a date field as a numeric value for ease of comparison and adjustment.
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.           
  188.           
  189.                                               -3-                                 GS_Date
  190.  
  191.  
  192.  
  193.          Griffin Solutions
  194.          ═════════════════
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.          GS_Date                                 -4-     
  253.  
  254.  
  255.  
  256.                                                                                  Addendum
  257.                                                                                  ════════
  258.           
  259.          2.  GS_STRNG:
  260.  
  261.          The GS_Strng routines provide string handling routines that simplify life for
  262.          the programmer.  Most of these provide a function that may be included as part
  263.          of another argument (such as writeln(AllCaps(locasestring))).
  264.  
  265.             Units used are:
  266.  
  267.                 Crt                           Turbo Pascal unit called to get the
  268.                                               Delay command.
  269.  
  270.                 Dos                           Turbo Pascal unit called to get the
  271.                                               current date.
  272.  
  273.                 GS_Date                       Griffin Solutions unit called for date
  274.                                               conversion procedures.
  275.  
  276.             Procedures/Functions used are:
  277.  
  278.                 AllCaps                       Function returns a string with lower-
  279.                                               case characters converted to uppercase.
  280.  
  281.                 CnvAscToStr                   Procedure to convert a ZASCII string (a
  282.                                               string terminated by a null 0) to a Turbo
  283.                                               Pascal string in which the first byte
  284.                                               contains the length.
  285.  
  286.                 CnvStrToAsc                   Procedure to convert a Turbo Pascal string
  287.                                               in which the first byte contains the string
  288.                                               length to a ZASCII string (a string which
  289.                                               is terminated by a null 0).
  290.  
  291.                 Strip_Flip                    Function will remove tailing spaces and
  292.                                               move any part of the string that is pre-
  293.                                               ceeded by a '~' to the end of the string.
  294.  
  295.                 StrDate                       Function will return a string value for
  296.                                               the numeric Julian Date value passed to
  297.                                               the routine.
  298.  
  299.                 StrLogic                      Function will return a string value for
  300.                                               the logical value passed to it.  The value
  301.                                               returned will be 'T' or 'F'.
  302.  
  303.                 StrNumber                     Function will return a string value for
  304.                                               the numeric real value passed to it.
  305.  
  306.                 SubStr                        Function will return a substring of the
  307.                                               string value passed to it.
  308.  
  309.                 TrimL                         Function will return a string with all of
  310.                                               the leading blank positions removed.
  311.  
  312.                 TrimR                         Function will return a string with all of
  313.           
  314.           
  315.                                              -5-                                 GS_Strng
  316.  
  317.  
  318.  
  319.          Griffin Solutions
  320.          ═════════════════
  321.  
  322.                                               the trailing blank positions removed.
  323.  
  324.                 Unique_Field                  Function will return a string composed of
  325.                                               eight unique characters.  Used to make a
  326.                                               unique data key.
  327.  
  328.                 ValDate                       Function will return a numeric Julian Date
  329.                                               value based on the string date passed to
  330.                                               the routine.
  331.  
  332.                 ValLogic                      Function will return a boolean value based
  333.                                               on the string value passed to the routine.
  334.  
  335.                 ValNumber                     Function will return a real number based
  336.                                               on the string value passed to the routine.
  337.  
  338.  
  339.             GS_String Interface:
  340.  
  341.                 uses
  342.                    Crt,
  343.                    Dos,
  344.                    GS_Date;
  345.  
  346.                 function  AllCaps(var t : string) : string;
  347.                 procedure CnvAscToStr(var asc, st; lth : integer);
  348.                 procedure CnvStrToAsc(var st, asc; lth : integer);
  349.                 function  Strip_Flip(st : string) : string;
  350.                 function  StrDate(jul : longint) : string;
  351.                 function  StrLogic(tf : boolean) : string;
  352.                 function  StrNumber(num : real; lth,dec : integer) : string;
  353.                 function  SubStr(s : string; b,l : integer) : string;
  354.                 function  TrimL(strn : string):string;
  355.                 function  TrimR(strn : string):string;
  356.                 function  Unique_Field : string;
  357.                 function  ValDate(strn : string) : longint;
  358.                 function  ValLogic(strn : string) : boolean;
  359.                 function  ValNumber(strn : string) : real;
  360.  
  361.  
  362.             Sample program:
  363.  
  364.                 The sample program, DB_Xpl16.PAS, demonstrates the features of this unit.
  365.                 Try the program to see how different string handling routines may be
  366.                 implemented.
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.          GS_Strng                                -6-     
  379.  
  380.  
  381.  
  382.                                                                                  Addendum
  383.                                                                                  ════════
  384.           
  385.          3.  GS_WINFC:
  386.  
  387.          The GS_Winfc unit forms an interface to the programmer's window unit.  It is
  388.          a front end to GS_Windw, but may be modified to call routines in another
  389.          window handler easily.  All Griffin Solutions calls to windows go through
  390.          GS_Winfc, and so this forms a 'hook' where the programmer may redirect
  391.          these windows calls if he so chooses.
  392.  
  393.  
  394.  
  395.             Units used are:
  396.  
  397.                 GS_Windw                      Griffin Solutions window routines.  You
  398.                                               may replace this unit with another and
  399.                                               modify the procedures to call the new
  400.                                               routines instead.
  401.  
  402.             Types/Constants/Variables used are:
  403.  
  404.                 GS_Wind_Objt                 Object that processes window requests
  405.  
  406.                 Win_Obj                      Object that links to GS_Windw.GS_Wind_Objt
  407.                                                to process window requests
  408.  
  409.                 x1, y1, x2, y2               Variables to hold window size
  410.  
  411.                 fg, bg, tx, bgh, txh         Variables to hold window colors.
  412.  
  413.  
  414.             Procedures/Functions/Methods used are:
  415.  
  416.                 GS_Wind_Objt.InitWin          Method to initialize a window.  Arguments
  417.                                               passed are window size, colors for text,
  418.                                               background, foreground, and inverted text
  419.                                               and background, boolean flag to determine
  420.                                               whether to draw a box around the window, a
  421.                                               name for the window, and a boolean flag to
  422.                                               preserve and restore screen areas that are
  423.                                               overwritten by the window.
  424.  
  425.                 GS_Wind_Objt.NamWin           Method to rename a window
  426.  
  427.                 GS_Wind_Objt.RelWin           Method to remove a window from the screen
  428.  
  429.                 GS_Wind_Objt.SetWin           Method to put a window on the screen
  430.  
  431.                 GS_Wind_GetColors             Procedure to get current window colors
  432.  
  433.                 GS_Wind_GetWinSize            Procedure to get current window size
  434.  
  435.                 GS_Wind_SetColors             Procedure to set new colors for the
  436.                                               current window.
  437.  
  438.                 GS_Wind_SetNmMode             Procedure to set normal mode colors
  439.           
  440.           
  441.                                              -7-                                 GS_Winfc
  442.  
  443.  
  444.  
  445.          Griffin Solutions
  446.          ═════════════════
  447.  
  448.                                               (normal text and background colors).
  449.  
  450.                 GS_Wind_SetFgMode             Procedure to set Emphasized mode colors
  451.                                               (normal foreground and background colors).
  452.  
  453.                 GS_Wind_SetIvMode             Procedure to set Inverted mode colors
  454.                                               (inverted fore and background colors).
  455.  
  456.  
  457.             GS_Winfc Interface:
  458.  
  459.                 uses
  460.                    GS_Windw;
  461.  
  462.                 type
  463.                    GS_Wind_Objt   = Object
  464.                                        Win_Obj : GS_Windw.GS_Wind_Objt;
  465.                                        x1,
  466.                                        y1,
  467.                                        x2,
  468.                                        y2      :  integer;  {Window size}
  469.                                        fg,                  {Foreground color}
  470.                                        bg,                  {Background color}
  471.                                        tx,                  {Text color}
  472.                                        bgh,                 {Inverted background color}
  473.                                        txh     :  byte;     {Inverted text color}
  474.  
  475.                                        procedure InitWin (x1w,y1w,x2w,y2w : integer;
  476.                                                           txw,bgw,fgw,txx,bgx : integer;
  477.                                                           dbox : boolean;
  478.                                                           bname : GS_Wind_Str80;
  479.                                                           cpywin : boolean);
  480.                                        procedure NamWin(bname:string);
  481.                                        procedure RelWin;
  482.                                        procedure SetWin;
  483.                                     end;
  484.  
  485.                 Procedure GS_Wind_GetColors(var txw,bgw,fgw,txx,bgx : byte);
  486.                 Procedure GS_Wind_GetWinSize(var x1,y1,x2,y2 : integer);
  487.                 Procedure GS_Wind_SetColors(txw,bgw,fgw,txx,bgx : byte);
  488.                 Procedure GS_Wind_SetNmMode;
  489.                 Procedure GS_Wind_SetFgMode;
  490.                 Procedure GS_Wind_SetIvMode;
  491.  
  492.             Sample program:
  493.  
  494.                 The sample program, DB_Xpl17.PAS, demonstrates the features of this unit.
  495.                 Try the program to see how easily windows may be implemented.
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.          GS_Winfc                                -8-     
  505.  
  506.  
  507.  
  508.                                                                                  Addendum
  509.                                                                                  ════════
  510.           
  511.          4. STATUSUPDATE:
  512.  
  513.          Several functions in GS_dBase can take some time to complete (e.g., IndexTo
  514.          and Pack).  For this reason, a virtual method StatusUpdate has been added to
  515.          the GS_dBFld unit to allow the user to gain access and track progress.  The
  516.          StatusUpdate method in GS_dBFld does nothing--it is there as the default if
  517.          the user chooses not to take advantage of the capability by adding his or her
  518.          own virtual StatusUpdate method.
  519.  
  520.             Sample program:
  521.  
  522.                 The sample program, DB_Xpl18.PAS, demonstrates the how this procedure
  523.                 may be installed in a user's program.  Note an Init and StatusUpdate
  524.                 method are implemented through a child object of GS_dBFld.  All calls
  525.                 to StatusUpdate anywhere in the object's heirarchy will come through
  526.                 this 'hook'.
  527.  
  528.             Constants passed as arguments are contained in the GS_dBFld unit,  they
  529.             are:
  530.  
  531.             StatusStart     = -1;        Passed to indicate a routine will be passing
  532.                                          status update information.
  533.  
  534.             StatusStop      = 0;         Signals termination by a routine, cancelling
  535.                                          status update processing.
  536.  
  537.             StatusIndexTo   = 1;         Token for identifying IndexTo as the routine
  538.                                          passing status information.
  539.  
  540.             StatusPack      = 2;         Token for identifying Paack as the routine
  541.                                          passing status information.
  542.  
  543.             The structure of a StatusUpdate call is:
  544.  
  545.                StatusUpdate(statword1, statword2, statword3);
  546.  
  547.                where the statword* values are type longint and will vary depending on
  548.                the contents of statword1.  For example:
  549.  
  550.                   statword1 = StatusStart
  551.                               statword2 = the calling routine token (StatusIndexTo or
  552.                                           StatusPack.
  553.                               statword3 = the number of records to be processed.
  554.  
  555.                   statword1 = StatusStop
  556.                               statword2 = 0
  557.                               statword3 = 0
  558.  
  559.                   statword1 = StatusIndexTo or StatusPack
  560.                               statword2 = current record number being processed
  561.                               statword3 = 0
  562.  
  563.             Refer to the sample program to see one way StatusUpdate may be used.
  564.  
  565.           
  566.           
  567.                                             -9-                              StatusUpdate
  568.  
  569.  
  570.  
  571.          Griffin Solutions
  572.          ═════════════════
  573.  
  574.  
  575.  
  576.          __________________________________________________
  577.          GS_Date_Century                 Boolean      Unit: GS_Date
  578.  
  579.          Flag used to set the format for showing the year.  When true, the GS_Date_View
  580.          function will return MM/DD/YYYY.  When false, only the last two digits of the
  581.          year will be returned (MM/DD/YY).  The default is false.
  582.  
  583.          __________________________________________________
  584.          GS_Date_JulInv                  Constant     Unit: GS_Date
  585.  
  586.          Constant value (-1) returned during conversion of string dates to a Julian
  587.          Date longint value.  If the date is a valid one (03/01/0000 to 12/31/65335),
  588.          the numeric value is returned.  If the date is invalid, GS_Date_JulInv value
  589.          is returned.
  590.  
  591.          __________________________________________________
  592.          GS_Date_StrTyp                  Type         Unit: GS_Date
  593.  
  594.          Variable type of string[10] used to contain the string date values.  This will
  595.          hold an eight-character value in dBase format (YYYYMMDD), or either an eight
  596.          or ten-character value in view format (MM/DD/YY or MM/DD/YYYY).  The length is
  597.          dependent on the status in GS_Date_Century, which dictates whether the year is
  598.          representer with two or four characters.
  599.  
  600.          __________________________________________________
  601.          GS_Date_ValTyp                  Type         Unit: GS_Date
  602.  
  603.          Variable type of LongInt used to contain the Julian Date.  This may be used to
  604.          easily add/subtract/compare dates.
  605.  
  606.  
  607.  
  608.  
  609.  
  610.  
  611.  
  612.  
  613.  
  614.  
  615.  
  616.  
  617.  
  618.  
  619.  
  620.  
  621.  
  622.  
  623.  
  624.  
  625.  
  626.  
  627.  
  628.  
  629.  
  630.          Data Items                              -10-      
  631.  
  632.  
  633.  
  634.                                                                                  Addendum
  635.                                                                                  ════════
  636.           
  637.          __________________________________________________
  638.          AllCaps                         Function     Unit: GS_Strng
  639.  
  640.          Function to convert a string to uppercase.
  641.  
  642.          Call:
  643.  
  644.                NewStr := AllCaps(OldStr)
  645.  
  646.          Where:
  647.  
  648.                OldStr is the string to be converted.
  649.  
  650.                NewStr is the string to hold the converted value.
  651.  
  652.          Result:
  653.  
  654.                A string converted to all uppercase values is returned.
  655.  
  656.          __________________________________________________
  657.          CnvAscToStr                     Procedure    Unit: GS_Strng
  658.  
  659.          Procedure to convert a ZASCII string (a string terminated by a null 0) to a
  660.          Turbo Pascal string in which the first byte contains the length.
  661.  
  662.          Call:
  663.  
  664.                CnvAscToStr(AscString, TPString, size)
  665.  
  666.          Where:
  667.  
  668.                AscString is the string to be converted (terminated by a zero).
  669.  
  670.                TPString is the Turbo Pascal string to hold the converted value.
  671.  
  672.                size is the maximum length of the string to move.  This should
  673.                     normally be sizeof(TPString)-1, to ensure there is no overrun
  674.                     of the Turbo Pascal string size.  Sizeof gets the size of the
  675.                     string, including the length byte.  Therefore, one must be
  676.                     subtracted to adjust for actual positions available.
  677.  
  678.          Result:
  679.  
  680.                A string of characters in memory is moved to a Turbo Pascal string
  681.          variable.  if there is a null (zero) character within the length of the
  682.          moved string, that position is used to set the string length.  Otherwise,
  683.          the length of the string is set to the size argument.
  684.  
  685.          __________________________________________________
  686.          CnvStrToAsc                     Procedure    Unit: GS_Strng
  687.  
  688.          Procedure to convert a Turbo Pascal string in which the first byte contains
  689.          the string length to a ZASCII string (a string which is terminated by a null
  690.          (zero).
  691.           
  692.           
  693.                                              -11-                                Routines
  694.  
  695.  
  696.  
  697.          Griffin Solutions
  698.          ═════════════════
  699.  
  700.          Call:
  701.  
  702.                CnvStrToAsc(TPString, AscString, size)
  703.  
  704.          Where:
  705.  
  706.                TPString is the Turbo Pascal string to convert.
  707.  
  708.                AscString is the location to store the converted string (terminated by a
  709.                          zero).
  710.  
  711.                size is the maximum length of the string to move.  This should
  712.                     normally be sizeof(AscString), to ensure there is no overrun
  713.                     of the ZASCII string size.  Sizeof gets the maximum size of the
  714.                     string.  Therefore, the programmer must ensure the actual string
  715.                     moved is at least one less, to adjust for actual positions
  716.                     available, and still accomodate a final null byte.
  717.  
  718.          Result:
  719.  
  720.                A Turbo Pascal string is moved to a series of consecutive locations
  721.          in memory.  A null (zero) character is inserted as the final byte to create
  722.          a ZASCII string.
  723.  
  724.          __________________________________________________
  725.          DateGet                         Function     Unit: GS_dBFld
  726.  
  727.          Function method that returns the formatted date from a record date field. The
  728.          value returned will be a numeric longint value representing the Julian date
  729.          value.
  730.  
  731.          Call:
  732.  
  733.                NewVal := ObjectName.DataGet(FldStr)
  734.  
  735.          Where:
  736.  
  737.                ObjectName is the child object name the programmer assigns for
  738.          GS_dBFld_Objt.
  739.  
  740.                FldStr is the string containing the field name for the field desired.
  741.  
  742.                NewVal is a longint variable where the converted date field data will be
  743.          placed.
  744.  
  745.          Result:
  746.  
  747.                The date in numeric Julian Date value will be returned.  If the date in
  748.          the dBase field is invalid, less than 3 Mar 0000, or greater than 31 Dec 65536,
  749.          a -1 will be returned.
  750.  
  751.          __________________________________________________
  752.          DatePut                         Procedure    Unit: GS_dBFld
  753.  
  754.  
  755.  
  756.          Routines                                -12-     
  757.  
  758.  
  759.  
  760.                                                                                  Addendum
  761.                                                                                  ════════
  762.           
  763.          Procedure method that stores a date value in a record field.  The value stored
  764.          will be in longint Julian date.  It will be converted to the character string
  765.          YYYYMMDD to be stored in the dBase record.
  766.  
  767.          Call:
  768.  
  769.                ObjectName.DatePut(FldStr, DatVal)
  770.  
  771.          Where:
  772.  
  773.                ObjectName is the child object name the programmer assigns for
  774.          GS_dBFld_Objt.
  775.  
  776.                FldStr is the string containing the field name for the field desired.
  777.  
  778.                DatVal is a longint variable containing the date in Julian Date format to
  779.          be converted and stored in the record field.
  780.  
  781.          Result:
  782.  
  783.                The date in YYYYMMDD format will be stored in the current record in the
  784.          specified field.
  785.  
  786.          __________________________________________________
  787.          GS_Date_Curr                    Function     Unit: GS_Date
  788.  
  789.          Function that returns the current date through a system DOS call. The value
  790.          returned will be a numeric longint value representing the Julian date value.
  791.  
  792.          Call:
  793.  
  794.                CurVal := GS_Date_Curr
  795.  
  796.          Where:
  797.  
  798.                CurVal is a longint variable where the Julian Date value for Today's
  799.          Date will be placed.
  800.  
  801.          Result:
  802.  
  803.                The date in numeric Julian Date value will be returned.  If the date in
  804.          the dBase field is invalid, less than 3 Mar 0000, or greater than 31 Dec 65536,
  805.          a -1 will be returned.
  806.  
  807.          __________________________________________________
  808.          GS_Date_DBStor                  Function     Unit: GS_Date
  809.  
  810.          Function that returns a string value in dBase storage format (YYYYMMDD) based
  811.          on the Julian Date provided.
  812.  
  813.          Call:
  814.  
  815.                StrVal := GS_Date_DBStor(JulVal)
  816.  
  817.           
  818.           
  819.                                              -13-                                Routines
  820.  
  821.  
  822.  
  823.          Griffin Solutions
  824.          ═════════════════
  825.  
  826.          Where:
  827.  
  828.                JulVal is a longint variable containing a Julian Date value.
  829.  
  830.                StrVal will contain the string date in YYYYMMDD.
  831.  
  832.          Result:
  833.  
  834.                Date in YYYYMMDD will be returned in StrVal.
  835.  
  836.          __________________________________________________
  837.          GS_Date_Jul2MDY                 Procedure    Unit: GS_Date
  838.  
  839.          Procedure that converts a longint Julian Date value to the component month,
  840.          day, and year numeric values.
  841.  
  842.          Call:
  843.  
  844.                GS_Date_Jul2MDY(JulVal, month, day, year)
  845.  
  846.          Where:
  847.  
  848.                JulVal is a longint variable containing a Julian Date value.
  849.  
  850.                month,
  851.                day,
  852.                year - are word variables that will hold the month, day, and year values
  853.                       that the Julian Date converts.  These variables must be defined
  854.                       as variables of type word.
  855.  
  856.  
  857.          Result:
  858.  
  859.                The Julian Date numeric value will be returned as its month, day, and
  860.                year component numeric values.
  861.  
  862.          __________________________________________________
  863.          GS_Date_Juln                    Function     Unit: GS_Date
  864.  
  865.          Function that returns a Julian date as a longint value.  The input value is a
  866.          string in MM/DD/YY, MM/DD/YYYY, or YYYYMMDD format.
  867.  
  868.          Call:
  869.  
  870.                JulVal := GS_Date_Juln(StrVal)
  871.  
  872.          Where:
  873.  
  874.                StrVal will contain the string date in MM/DD/YY, MM/DD/YYYY or YYYYMMDD.
  875.  
  876.                JulVal is a longint variable that will contain a Julian Date value.
  877.  
  878.          Result:
  879.  
  880.  
  881.  
  882.          Routines                                -14-     
  883.  
  884.  
  885.  
  886.                                                                                  Addendum
  887.                                                                                  ════════
  888.           
  889.                The date in numeric Julian Date value will be returned.  If the date in
  890.          the string field is invalid, less than 3 Mar 0000 or greater than 31 Dec 65536,
  891.          a -1 will be returned.
  892.  
  893.          __________________________________________________
  894.          GS_Date_MDY2Jul                 Function     Unit: GS_Date
  895.  
  896.          Function that returns a Julian date as a longint value.  The input consists of
  897.          the numeric month, day, and year.
  898.  
  899.          Call:
  900.  
  901.                JulVal := GS_Date_Juln(month, day, year)
  902.  
  903.          Where:
  904.  
  905.                month,
  906.                day,
  907.                year - are word variables that will hold the month, day, and year values
  908.                       for the Julian Date conversion.
  909.  
  910.                JulVal is a longint variable that will contain a Julian Date value.
  911.  
  912.          Result:
  913.  
  914.                The date in numeric Julian Date value will be returned.  If the date in
  915.          the string field is invalid, less than 3 Mar 0000 or greater than 31 Dec 65536,
  916.          a -1 will be returned.
  917.  
  918.          __________________________________________________
  919.          GS_Date_View                    Function     Unit: GS_Date
  920.  
  921.          Function that returns a string value in a viewable format (MM/DD/YY or
  922.          MM/DD/YYYY) based on the Julian Date provided.  The number of characters that
  923.          will be in the year position is determined by the status of GS_Date_Century
  924.          (False for YY, true for YYYY).
  925.  
  926.          Call:
  927.  
  928.                StrVal := GS_Date_View(JulVal)
  929.  
  930.          Where:
  931.  
  932.                JulVal is a longint variable containing a Julian Date value.
  933.  
  934.                StrVal will contain the string date in MM/DD/YY or MM/DD/YYYY.
  935.  
  936.          Result:
  937.  
  938.                Date in MM/DD/YY or MM/DD/YYYY will be returned in StrVal.
  939.  
  940.          __________________________________________________
  941.          GS_Wind_GetColors               Procedure    Unit: GS_Winfc
  942.  
  943.           
  944.           
  945.                                              -15-                                Routines
  946.  
  947.  
  948.  
  949.          Griffin Solutions
  950.          ═════════════════
  951.  
  952.          Retrieves the colors used by the current window
  953.  
  954.          Call:
  955.  
  956.                GS_Wind_GetColors(txn, bgn, fgn, txi, bgi)
  957.  
  958.          Where:
  959.  
  960.                txn is an integer variable that will hold the normal text color.
  961.  
  962.                bgn is an integer variable that will hold the normal background
  963.                    color.
  964.  
  965.                fgn is an integer variable that will hold the normal foreground
  966.                    color (used for highlighting).
  967.  
  968.                txi is an integer variable that will hold the text color used
  969.                    during inverted mode.
  970.  
  971.                bgi is an integer variable that will hold the text color used
  972.                    during inverted mode.
  973.  
  974.          Result:
  975.  
  976.                The current window color values will be stored in txn, bgn, fgn,
  977.          txi, and bgi.
  978.  
  979.          __________________________________________________
  980.          GS_Wind_GetWinSize              Procedure    Unit: GS_Winfc
  981.  
  982.          Retrieves the screen window size used by the current window
  983.  
  984.          Call:
  985.  
  986.                GS_Wind_GetWinSize(x1, y1, x2, y2)
  987.  
  988.          Where:
  989.  
  990.                x1 and y1 are coordinates of upper left corner of the window.
  991.  
  992.                x2 and y2 are coordinates of the lower right corner of the window.
  993.  
  994.          Result:
  995.  
  996.                The current window size values will be stored in x1, y1, x2, and y2.
  997.  
  998.          __________________________________________________
  999.          GS_Wind_SetColors               Procedure    Unit: GS_Winfc
  1000.  
  1001.          Assigns new colors to be used by the current window.
  1002.  
  1003.          Call:
  1004.  
  1005.                GS_Wind_SetColors(txn, bgn, fgn, txi, bgi)
  1006.  
  1007.  
  1008.          Routines                                -16-     
  1009.  
  1010.  
  1011.  
  1012.                                                                                  Addendum
  1013.                                                                                  ════════
  1014.           
  1015.          Where:
  1016.  
  1017.                txn is an integer variable holding the normal text color.
  1018.  
  1019.                bgn is an integer variable holding the normal background color.
  1020.  
  1021.                fgn is an integer variable holding the normal foreground color
  1022.                    (used for highlighting).
  1023.  
  1024.                txi is an integer variable holding the text color used during
  1025.                    inverted mode.
  1026.  
  1027.                bgi is an integer variable holding the text color used during
  1028.                inverted mode.
  1029.  
  1030.          Result:
  1031.  
  1032.                The current window color values will be set to the values in txn,
  1033.          bgn, fgn, txi, and bgi.  They will not become effective until the window is
  1034.          released and set again or a GS_Wind_Set**Mode command is issued.
  1035.  
  1036.          __________________________________________________
  1037.          GS_Wind_SetFgMode               Procedure    Unit: GS_Winfc
  1038.  
  1039.          Sets window colors to highlighted mode.
  1040.  
  1041.          Call:
  1042.  
  1043.                GS_Wind_SetFgMode
  1044.  
  1045.          Result:
  1046.  
  1047.                The current window color values will be set to the values for
  1048.          highlighted text (using foreground color) and background.
  1049.  
  1050.          __________________________________________________
  1051.          GS_Wind_SetIvMode               Procedure    Unit: GS_Winfc
  1052.  
  1053.          Sets window colors to inverted mode.
  1054.  
  1055.          Call:
  1056.  
  1057.                GS_Wind_SetIvMode
  1058.  
  1059.          Result:
  1060.  
  1061.                The current window color values will be set to the values for
  1062.          inverted text and background.
  1063.  
  1064.          __________________________________________________
  1065.          GS_Wind_SetNmMode               Procedure    Unit: GS_Winfc
  1066.  
  1067.          Sets window colors to normal mode.
  1068.  
  1069.           
  1070.           
  1071.                                              -17-                                Routines
  1072.  
  1073.  
  1074.  
  1075.          Griffin Solutions
  1076.          ═════════════════
  1077.  
  1078.          Call:
  1079.  
  1080.                GS_Wind_SetNmMode
  1081.  
  1082.          Result:
  1083.  
  1084.                The current window color values will be set to the values for
  1085.          normal text and background.
  1086.  
  1087.          __________________________________________________
  1088.          InitWin                         Procedure    Unit: GS_Winfc
  1089.  
  1090.          Method that initializes a windows object.
  1091.  
  1092.          Call:
  1093.  
  1094.                ObjectName.InitWin(xBegin, yBegin, xEnd, yEnd, ClrTx, ClrBg,
  1095.          ClrFg, ClrIvTx, ClrIvBg, DrawBox, WinName, SaveScreen)
  1096.  
  1097.          Where:
  1098.  
  1099.                ObjectName is the child object the programmer assigns for
  1100.                           GS_Wind_Objt.
  1101.  
  1102.                xBegin is an integer beginning column position on the screen for
  1103.                       the window.
  1104.  
  1105.                yBegin is an integer beginning row position on the screen for
  1106.                       the window.
  1107.  
  1108.                xEnd is an integer ending column position on the screen for the
  1109.                     window.
  1110.  
  1111.                yEnd is an integer ending row position on the screen for the
  1112.                     window.
  1113.  
  1114.                ClrTx is the color to assign to text in the window.
  1115.  
  1116.                ClrBg is the background color for the window.
  1117.  
  1118.                ClrFg is the forground color for the window. This is the color the
  1119.                      box outline and title will have.
  1120.  
  1121.                ClrIvTx is the color for text in the inverted mode.
  1122.  
  1123.                ClrIvBg is the background color in inverted mode.
  1124.  
  1125.                DrawBox is a boolean value indicating if a box should be drawn.
  1126.                        If a box is drawn, the actual window will be inside the box,
  1127.                        and not the window values passed to the method.
  1128.  
  1129.                WinName is the title to center in the top of the window.  This
  1130.                        will only be displayed if a box is drawn.
  1131.  
  1132.  
  1133.  
  1134.          Routines                                -18-     
  1135.  
  1136.  
  1137.  
  1138.                                                                                  Addendum
  1139.                                                                                  ════════
  1140.           
  1141.                SaveScreen is a boolean argument to save the screen contents
  1142.                           before a window is displayed, and to restore the screen
  1143.                           when the window is released.
  1144.  
  1145.          Result:
  1146.  
  1147.                A window object is initialized and may be set with WinSet and
  1148.          released with WinRel.  It will use the colors that are established in
  1149.          the initialization process.
  1150.  
  1151.          __________________________________________________
  1152.          NamWin                          Procedure    Unit: GS_Winfc
  1153.  
  1154.          Method that assigns a new name to a window.  The name will be displayed
  1155.          when the window is opened, if the window is boxed.
  1156.  
  1157.          Call:
  1158.  
  1159.                ObjectName.NamWin(boxname)
  1160.  
  1161.          Where:
  1162.  
  1163.                ObjectName is the child object the programmer assigns for
  1164.                           GS_Wind_Objt.
  1165.  
  1166.                boxname is a string containing the new name for the window.
  1167.  
  1168.          Result:
  1169.  
  1170.                The window associated with the object is assigned the name passed in
  1171.                the argument boxname.  The new name will be displayed when the window
  1172.                is opened, if a box is drawn around the window.
  1173.  
  1174.          __________________________________________________
  1175.          RelWin                          Procedure    Unit: GS_Winfc
  1176.  
  1177.          Method that releases a window.
  1178.  
  1179.          Call:
  1180.  
  1181.                ObjectName.RelWin
  1182.  
  1183.          Where:
  1184.  
  1185.                ObjectName is the child object the programmer assigns for
  1186.                           GS_Wind_Objt.
  1187.  
  1188.          Result:
  1189.  
  1190.                The window associated with the object is released, the window that
  1191.          was active before this window was set is activated, and the screen
  1192.          contents are restored if the option was initialized.
  1193.  
  1194.          __________________________________________________
  1195.           
  1196.           
  1197.                                              -19-                                Routines
  1198.  
  1199.  
  1200.  
  1201.          Griffin Solutions
  1202.          ═════════════════
  1203.  
  1204.          SetWin                          Procedure    Unit: GS_Winfc
  1205.  
  1206.          Method that opens a window.
  1207.  
  1208.          Call:
  1209.  
  1210.                ObjectName.SetWin
  1211.  
  1212.          Where:
  1213.  
  1214.                ObjectName is the child object the programmer assigns for
  1215.                           GS_Wind_Objt.
  1216.  
  1217.          Result:
  1218.  
  1219.                The window associated with the object is opened.  If applicable,
  1220.          the previous contents of the screen are saved for restoral when the
  1221.          window is released.  The object pointer of the previous window is also
  1222.          saved so that window can be made active when this window is released.
  1223.  
  1224.          __________________________________________________
  1225.          StrDate                         Function     Unit: GS_Strng
  1226.  
  1227.          Function to convert a longint Julian Date to a formatted date field (MM/DD/YY
  1228.          or MM/DD/YYYY).  The number of characters that will be in the year position is
  1229.          determined by the status of GS_Date_Century (False for YY, true for YYYY).
  1230.  
  1231.          Call:
  1232.  
  1233.                NewDate := StrDate(OldJuln)
  1234.  
  1235.          Where:
  1236.  
  1237.                OldJuln is the longint julian date to be converted.
  1238.  
  1239.                NewDate is the string to hold the converted value.
  1240.  
  1241.          Result:
  1242.  
  1243.                Date in MM/DD/YY or MM/DD/YYYY will be returned in StrVal.
  1244.  
  1245.          __________________________________________________
  1246.          StrLogic                        Function     Unit: GS_Strng
  1247.  
  1248.          Function to convert a boolean value to a string containing 'T' or 'F'.
  1249.  
  1250.          Call:
  1251.  
  1252.                NewLogic := StrLogic(bool)
  1253.  
  1254.          Where:
  1255.  
  1256.                bool is the boolean value to be converted.
  1257.  
  1258.  
  1259.  
  1260.          Routines                                -20-     
  1261.  
  1262.  
  1263.  
  1264.                                                                                  Addendum
  1265.                                                                                  ════════
  1266.           
  1267.                NewLogic is the string to hold the converted value.
  1268.  
  1269.          Result:
  1270.  
  1271.                A string holding 'T' or 'F' is returned.
  1272.  
  1273.          __________________________________________________
  1274.          Strip_Flip                      Function     Unit: GS_Strng
  1275.  
  1276.          This function will remove trailing spaces and move any part of the string
  1277.          that is preceeded by a '~' to the end of the string.  For Example:
  1278.          "Smith~John X." will be converted to "John X. Smith" on return.
  1279.  
  1280.          Call:
  1281.  
  1282.                NewStr := Strip_Flip(OldStr)
  1283.  
  1284.          Where:
  1285.  
  1286.                OldStr is the string to be converted.
  1287.  
  1288.                NewStr is the string to hold the converted value.
  1289.  
  1290.          Result:
  1291.  
  1292.                OldStr will be converted and returned in NewStr.  Trailing spaces are
  1293.                deleted and any part of the string preceeded by a "~" is flipped to the
  1294.                end of the string.
  1295.  
  1296.  
  1297.          __________________________________________________
  1298.          StrNumber                       Function     Unit: GS_Strng
  1299.  
  1300.          Function to convert a numeric value to a string.
  1301.  
  1302.          Call:
  1303.  
  1304.                NewNumber := StrNumber(OldNum, Lgth, Dcml)
  1305.  
  1306.          Where:
  1307.  
  1308.                OldNum is the numeric type real value to be converted.
  1309.  
  1310.                Lgth is the integer length to use for the string.
  1311.  
  1312.                Dcml is the integer value for number of decimal places.
  1313.  
  1314.                NewNumber is the string to hold the converted value.
  1315.  
  1316.          Result:
  1317.  
  1318.                A string holding the numeric value is returned.
  1319.  
  1320.          __________________________________________________
  1321.           
  1322.           
  1323.                                              -21-                                Routines
  1324.  
  1325.  
  1326.  
  1327.          Griffin Solutions
  1328.          ═════════════════
  1329.  
  1330.          SubStr                          Function     Unit: GS_Strng
  1331.  
  1332.          Function to return a substring from a string.  As a function, this will
  1333.          allow the user to use the routine directly in other arguments such as
  1334.          write statements.
  1335.  
  1336.          Call:
  1337.  
  1338.                NewStr := SubStr(OldStr, Strt, Lgth)
  1339.  
  1340.          Where:
  1341.  
  1342.                OldStr is the string from which the substring is to be extracted.
  1343.  
  1344.                Strt is the integer number for the starting location within the
  1345.          string.
  1346.  
  1347.                Lgth is the integer number of positions to extract.
  1348.  
  1349.                NewStr is the string to hold the extracted value.
  1350.  
  1351.          Result:
  1352.  
  1353.                A string holding the substring value is returned.
  1354.  
  1355.          __________________________________________________
  1356.          TrimL                           Function     Unit: GS_Strng
  1357.  
  1358.          Function to remove leading spaces from a string.
  1359.  
  1360.          Call:
  1361.  
  1362.                NewStr := TrimL(OldStr)
  1363.  
  1364.          Where:
  1365.  
  1366.                OldStr is the string to be converted.
  1367.  
  1368.                NewStr is the string to hold the converted value.
  1369.  
  1370.          Result:
  1371.  
  1372.                A string with all leading spaces removed is returned.
  1373.  
  1374.          __________________________________________________
  1375.          TrimR                           Function     Unit: GS_Strng
  1376.  
  1377.          Function to remove trailing spaces from a string.
  1378.  
  1379.          Call:
  1380.  
  1381.                NewStr := TrimR(OldStr)
  1382.  
  1383.          Where:
  1384.  
  1385.  
  1386.          Routines                                -22-     
  1387.  
  1388.  
  1389.  
  1390.                                                                                  Addendum
  1391.                                                                                  ════════
  1392.           
  1393.                OldStr is the string to be converted.
  1394.  
  1395.                NewStr is the string to hold the converted value.
  1396.  
  1397.          Result:
  1398.  
  1399.                A string with all trailing spaces removed is returned.
  1400.  
  1401.          __________________________________________________
  1402.          Unique_Field                    Function     Unit: GS_Strng
  1403.  
  1404.          Function to return an eight-character unique string.  This is useful to make
  1405.          a one-of-a-kind data name as a unique key.  Punctuation symbols will also be
  1406.          used, so it may not be useful as a unique file name.  A primary purpose of
  1407.          this function is to create a unique linking name between related files where
  1408.          no other data record is assured of being unique.  For example, in a family
  1409.          tree file, there may be several people with the same name.  By adding a unique
  1410.          key when a new name is entered, you may be assured of "uniqueness" of record
  1411.          identifiers for related files, such as spouse or parent files.
  1412.  
  1413.          Call:
  1414.  
  1415.                NewStr := TrimR(OldStr)
  1416.  
  1417.          Where:
  1418.  
  1419.                OldStr is the string to be converted.
  1420.  
  1421.                NewStr is the string to hold the converted value.
  1422.  
  1423.          Result:
  1424.  
  1425.                A string with all trailing spaces removed is returned.
  1426.  
  1427.          __________________________________________________
  1428.          ValDate                         Function     Unit: GS_Strng
  1429.  
  1430.          Function to convert a string date field (MM/DD/YY, MM/DD/YYYY, or YYYYMMDD) to
  1431.          a longint Julian Date.
  1432.  
  1433.          Call:
  1434.  
  1435.                NewJuln := ValDate(OldDate)
  1436.  
  1437.          Where:
  1438.  
  1439.                OldDate is the string holding the date in MM/DD/YY, MM/DD/YYYY, or
  1440.                        YYYYMMDD format.
  1441.  
  1442.                NewJuln is the longint julian date variable to hold the returned value.
  1443.  
  1444.          Result:
  1445.  
  1446.                The date in numeric Julian Date value will be returned.  If the date in
  1447.           
  1448.           
  1449.                                              -23-                                Routines
  1450.  
  1451.  
  1452.  
  1453.          Griffin Solutions
  1454.          ═════════════════
  1455.  
  1456.          the string field is invalid, blank, less than 3 Mar 0000 or greater than 31 Dec
  1457.          65536, a 0 will be returned.  Note the difference between this and the -1
  1458.          returned by GS_Date_Juln.  A zero is returned to maintain consistency with an
  1459.          all-blank date field in a dBase record.
  1460.  
  1461.          __________________________________________________
  1462.          ValLogic                        Function     Unit: GS_Strng
  1463.  
  1464.          Function to convert string to a boolean value.
  1465.  
  1466.          Call:
  1467.  
  1468.                bool := StrLogic(OldLogic)
  1469.  
  1470.          Where:
  1471.  
  1472.                OldLogic is the string holding a character to be converted.
  1473.  
  1474.                bool is the converted boolean value.
  1475.  
  1476.          Result:
  1477.  
  1478.                If the OldLogic value is "T","t","Y", or "y", bool is set true, else
  1479.          bool is set false.
  1480.  
  1481.          __________________________________________________
  1482.          ValNumber                       Function     Unit: GS_Strng
  1483.  
  1484.          Function to convert a string to a numeric value.
  1485.  
  1486.          Call:
  1487.  
  1488.                NewNumber := ValNumber(OldNum)
  1489.  
  1490.          Where:
  1491.  
  1492.                NewNumber is the converted numeric type real value.
  1493.  
  1494.                OldNum is the string to convert.
  1495.  
  1496.          Result:
  1497.  
  1498.                A numeric value is returned which is the string's value.  If the string
  1499.          is invalid, a zero is returned.
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.          Routines                                -24-     
  1513.  
  1514.  
  1515.  
  1516.                                                                                  Addendum
  1517.                                                                                  ════════
  1518.           
  1519.                               Sample Program to Demonstrate GS_Date
  1520.  
  1521.  
  1522.          program DB_Xpl15;
  1523.          uses
  1524.             CRT,
  1525.             DOS,
  1526.             GS_KeyI,
  1527.             GS_Winfc,
  1528.             GS_Date;
  1529.  
  1530.          var
  1531.             KeyinObj   : GS_KeyI_Objt;
  1532.             CurDateVal,
  1533.             WrkDateVal,
  1534.             RecDateVal : GS_Date_ValTyp;
  1535.             mm,
  1536.             dd,
  1537.             yy         : word;
  1538.  
  1539.          function Date_Read(x,y : integer; defdate : longint) : GS_Date_ValTyp;
  1540.          var
  1541.             t      : string[10];
  1542.             tl     : integer;
  1543.             okDate : boolean;
  1544.             jul    : longint;
  1545.          begin
  1546.             t := GS_Date_View(defdate);
  1547.             repeat
  1548.                GS_Wind_SetIVMode;
  1549.                tl := length(t);
  1550.                t := KeyInObj.EditString(t, x, y, tl);
  1551.                GS_Wind_SetNmMode;
  1552.                gotoxy(x,y);          {Go to start of field screen position}
  1553.                write(t,'':tl-length(t));
  1554.                                      {Rewrite the string on screen in the original color}
  1555.                jul := GS_Date_Juln(t);
  1556.                if jul <> GS_Date_JulInv then OkDate := true else OkDate := false;
  1557.                if not okDate then SoundBell(BeepTime,BeepFreq);
  1558.             until okDate;
  1559.             Date_Read := jul;
  1560.          end;
  1561.  
  1562.  
  1563.          begin
  1564.           {
  1565.             GS_Date_Century := true;
  1566.           }
  1567.             KeyInObj.Init;
  1568.             CurDateVal := GS_Date_Curr;
  1569.             ClrScr;
  1570.             GoToXY(1,1);
  1571.             Write('Current date is: ',GS_Date_View(CurDateVal));
  1572.             GoToXY(40,1);
  1573.           
  1574.           
  1575.                                              -25-                                Examples
  1576.  
  1577.  
  1578.  
  1579.          Griffin Solutions
  1580.          ═════════════════
  1581.  
  1582.             Write(CurDateVal);
  1583.             RecDateVal := 0;
  1584.             while RecDateVal <> CurDateVal do
  1585.             begin
  1586.                ClrScr;
  1587.                GoToXY(1,1);
  1588.                Write('Enter a date: ');
  1589.                RecDateVal := Date_Read(15,1,CurDateVal);
  1590.                GoToXY(1,2);
  1591.                Writeln('Date in dBase storage format is: ',GS_Date_DBStor(RecDateVal));
  1592.                Writeln('Date shown in "view" format is:  ',GS_Date_View(RecDateVal));
  1593.                Writeln('Days between today and record date = ',
  1594.                         CurDateVal-RecDateVal:6);
  1595.                Writeln('90 days after record date is: ',
  1596.                         GS_Date_View(RecDateVal+90));
  1597.                GS_Date_Jul2MDY(RecDateVal,mm,dd,yy);
  1598.                WrkDateVal := GS_Date_MDY2Jul(1,1,yy);
  1599.                Writeln('Days since Jan 1 are: ',RecDateVal-WrkDateVal);
  1600.                Writeln;
  1601.                Writeln('Press any key');
  1602.                WaitForKey;
  1603.             end;
  1604.          end.
  1605.  
  1606.  
  1607.  
  1608.  
  1609.  
  1610.  
  1611.  
  1612.  
  1613.  
  1614.  
  1615.  
  1616.  
  1617.  
  1618.  
  1619.  
  1620.  
  1621.  
  1622.  
  1623.  
  1624.  
  1625.  
  1626.  
  1627.  
  1628.  
  1629.  
  1630.  
  1631.  
  1632.  
  1633.  
  1634.  
  1635.  
  1636.  
  1637.  
  1638.          Examples                                -26-     
  1639.  
  1640.  
  1641.  
  1642.                                                                                  Addendum
  1643.                                                                                  ════════
  1644.           
  1645.                           Sample Program to Demonstrate GS_Strng
  1646.  
  1647.  
  1648.          program DB_Xpl16;
  1649.          {$V-}
  1650.          uses
  1651.             CRT,
  1652.             DOS,
  1653.             GS_Date,
  1654.             GS_Strng;
  1655.  
  1656.          var
  1657.             RealValue  : real;
  1658.             LogicValue : boolean;
  1659.             DateValue  : longint;
  1660.             LogicString,
  1661.             RealString,
  1662.             Str1String,
  1663.             Str2String,
  1664.             UniqString,
  1665.             DateString : string[20];
  1666.             ZASCII     : array[0..20] of char;
  1667.             i          : integer;
  1668.  
  1669.          begin
  1670.             ClrScr;
  1671.             Str1String := '  Smith~John    ';
  1672.             writeln('Original input -->':30,Str1String,'<--');
  1673.             writeln('UpperCase -->':30,AllCaps(Str1String),'<--');
  1674.             CnvStrToAsc(Str1String, ZASCII, sizeof(ZASCII));
  1675.             write('ZASCII String -->':30);
  1676.             i := 0;
  1677.             while ZASCII[i] <> #0 do
  1678.             begin
  1679.                write(ZASCII[i]);
  1680.                inc(i);
  1681.             end;
  1682.             writeln('<--');
  1683.             CnvAscToStr(ZASCII, Str2String, sizeof(Str2String)-1);
  1684.             writeln('Pascal String from ZASCII -->':30,Str2String,'<--');
  1685.             Str1String := TrimL(Str1String);
  1686.             writeln('Trim Leading Spaces -->':30,Str1String,'<--');
  1687.             Str1String := TrimR(Str1String);
  1688.             writeln('Trim Trailing Spaces -->':30,Str1String,'<--');
  1689.             writeln('Substring Chars 3-8 -->':30,SubStr(Str1String,3,6),'<--');
  1690.             writeln('Flip String at ~ -->':30,Strip_Flip(Str1String),'<--');
  1691.             writeln('Get Unique Field -->':30,Unique_Field,'<--');
  1692.             DateString := '02/28/1991';
  1693.             DateValue := ValDate(DateString);
  1694.             writeln('Julian Date for 02/28/1991 -->':30,DateValue,'<--');
  1695.             GS_Date_Century := false;
  1696.             writeln('Date+90 Days (Century Off) -->':30,StrDate(DateValue+90),'<--');
  1697.             GS_Date_Century := true;
  1698.             writeln('Date+90 Days (Century On)  -->':30,StrDate(DateValue+90),'<--');
  1699.           
  1700.           
  1701.                                              -27-                                Examples
  1702.  
  1703.  
  1704.  
  1705.          Griffin Solutions
  1706.          ═════════════════
  1707.  
  1708.             RealValue := 123.456;
  1709.             writeln('Value 123.456 w/ $ edit -->':30,'$',StrNumber(RealValue,6,2),'<--');
  1710.             RealString := StrNumber(RealValue + 78.9,9,4);
  1711.             writeln('String of 123.456 + 78.9 -->':30,RealString,'<--');
  1712.             writeln('Real of String/2   -->':30,ValNumber(RealString)/2,'<--');
  1713.             writeln('Formatted String/2   -->':30,ValNumber(RealString)/2:7:4,'<--');
  1714.             LogicValue := true;
  1715.             LogicString :=  StrLogic(LogicValue);
  1716.             writeln('Logic string for true -->':30,LogicString,'<--');
  1717.             writeln('Logic boolean for true -->':30,ValLogic(LogicString),'<--');
  1718.          end.
  1719.  
  1720.  
  1721.  
  1722.  
  1723.  
  1724.  
  1725.  
  1726.  
  1727.  
  1728.  
  1729.  
  1730.  
  1731.  
  1732.  
  1733.  
  1734.  
  1735.  
  1736.  
  1737.  
  1738.  
  1739.  
  1740.  
  1741.  
  1742.  
  1743.  
  1744.  
  1745.  
  1746.  
  1747.  
  1748.  
  1749.  
  1750.  
  1751.  
  1752.  
  1753.  
  1754.  
  1755.  
  1756.  
  1757.  
  1758.  
  1759.  
  1760.  
  1761.  
  1762.  
  1763.  
  1764.          Examples                                -28-     
  1765.  
  1766.  
  1767.  
  1768.                                                                                  Addendum
  1769.                                                                                  ════════
  1770.           
  1771.                           Sample Program to Demonstrate GS_Winfc
  1772.  
  1773.  
  1774.          program DB_Xpl17;
  1775.          uses
  1776.             CRT,
  1777.             GS_KeyI,
  1778.             GS_Winfc;
  1779.  
  1780.          const
  1781.             ColorChart : array[0..15] of string[12]
  1782.                          = ('Black','Blue','Green','Cyan','Red','Magenta',
  1783.                             'Brown','LightGray','DarkGray','LightBlue','LightGreen',
  1784.                             'LightCyan','LightRed','LightMagenta','Yellow','White');
  1785.  
  1786.          var
  1787.             AskWin,
  1788.             StatusWin,
  1789.             WorkWin     : GS_Wind_Objt;
  1790.             textnrml,
  1791.             foregrnd,
  1792.             backnrml,
  1793.             texthilt,
  1794.             backhilt    : byte;
  1795.             x1,y1,x2,y1 : integer;
  1796.          procedure ShowColors;
  1797.          begin
  1798.             GS_Wind_GetColors(textnrml,backnrml,foregrnd,texthilt,backhilt);
  1799.             GS_Wind_SetFgMode;
  1800.             writeln('ForeGround Color is ',ColorChart[foregrnd]);
  1801.             GS_Wind_SetIvMode;
  1802.             writeln('Highlighted Text Color is ',ColorChart[texthilt]);
  1803.             writeln('Highlighted BackGround Color is ',ColorChart[backhilt]);
  1804.             GS_Wind_SetNmMode;
  1805.             writeln('Normal Text Color is ',ColorChart[textnrml]);
  1806.             writeln('Normal BackGround Color is ',ColorChart[backnrml]);
  1807.          end;
  1808.  
  1809.          begin
  1810.             ClrScr;
  1811.             WorkWin.InitWin(1,1,80,19,Red,Black,Yellow,Blue,LightGray,True,
  1812.                                 '[ COLOR INFORMATION ]',true);
  1813.             AskWin.InitWin(20,8,60,12,Yellow,Blue,Yellow,Black,LightGray,true,
  1814.                            '',true);
  1815.             StatusWin.InitWin(1,20,80,25,Yellow,Red,Yellow,Red,LightGray,true,'',true);
  1816.             WorkWin.SetWin;
  1817.             GS_Wind_GetWinSize(x1,y1,x2,y2);
  1818.             GotoXY(1,1);
  1819.             writeln('Window size parameters are ',x1,',',y1,',',x2,',',y2);
  1820.             writeln;
  1821.             ShowColors;
  1822.             GS_Wind_SetColors(Magenta,Cyan,Blue,Yellow,Green);
  1823.             GS_Wind_SetNmMode;
  1824.             writeln;
  1825.           
  1826.           
  1827.                                              -29-                                Examples
  1828.  
  1829.  
  1830.  
  1831.          Griffin Solutions
  1832.          ═════════════════
  1833.  
  1834.             writeln('  Colors are now different');
  1835.             writeln;
  1836.             ShowColors;
  1837.             StatusWin.NamWin('[ Labeling the Status Box ]');
  1838.             StatusWin.SetWin;
  1839.             AskWin.SetWin;
  1840.             GoToXY(5,2);
  1841.             write('Press any key to continue');
  1842.             WaitForKey;
  1843.             AskWin.RelWin;
  1844.             GoToXY(5,2);
  1845.             write('Press any key to exit');
  1846.             WaitForKey;
  1847.             StatusWin.RelWin;
  1848.             WorkWin.RelWin;
  1849.          end.
  1850.  
  1851.  
  1852.  
  1853.  
  1854.  
  1855.  
  1856.  
  1857.  
  1858.  
  1859.  
  1860.  
  1861.  
  1862.  
  1863.  
  1864.  
  1865.  
  1866.  
  1867.  
  1868.  
  1869.  
  1870.  
  1871.  
  1872.  
  1873.  
  1874.  
  1875.  
  1876.  
  1877.  
  1878.  
  1879.  
  1880.  
  1881.  
  1882.  
  1883.  
  1884.  
  1885.  
  1886.  
  1887.  
  1888.  
  1889.  
  1890.          Examples                                -30-     
  1891.  
  1892.  
  1893.  
  1894.                                                                                  Addendum
  1895.                                                                                  ════════
  1896.           
  1897.                     Sample Program to Demonstrate GS_dBFld_Objt.StatusUpdate
  1898.  
  1899.  
  1900.          program DB_Xpl18;
  1901.          uses
  1902.             CRT,
  1903.             DOS,
  1904.             GS_Winfc,
  1905.             GS_dBFld,
  1906.             GS_dBase;
  1907.  
  1908.          type
  1909.             Talk_Obj  = object(GS_dBFld_Objt)
  1910.                            constructor Init(FName : string);
  1911.                            procedure   StatusUpdate(statword1,statword2,
  1912.                                                      statword3 : longint); virtual;
  1913.                         end;
  1914.  
  1915.          var
  1916.             Health  : Talk_Obj;
  1917.             TalkWin   : GS_Wind_Objt;
  1918.  
  1919.  
  1920.          constructor Talk_Obj.Init(FName : string);
  1921.          begin
  1922.             GS_dBFld_Objt.Init(FName);
  1923.             TalkWin.InitWin(10,10,70,15,Blue,LightGray,Yellow,LightGray,Black,true,
  1924.                            '',true);
  1925.          end;
  1926.  
  1927.          procedure Talk_Obj.StatusUpdate(statword1,statword2,statword3 : longint);
  1928.          begin
  1929.             case statword1 of
  1930.                StatusStart   : begin
  1931.                                   case statword2 of
  1932.                                      StatusPack  : TalkWin.NamWin('[ Pack Progress ]');
  1933.                                      StatusIndexTo : TalkWin.NamWin
  1934.                                                              ('[ Index Progress ]');
  1935.                                   end;
  1936.                                   TalkWin.SetWin;
  1937.                                   GotoXY(26,3);
  1938.                                   write('Total Records to Process = ',statword3);
  1939.                                end;
  1940.                StatusStop    : begin
  1941.                                   TalkWin.RelWin;
  1942.                                end;
  1943.                StatusPack,
  1944.                StatusIndexTo : begin
  1945.                                   GoToXy(2,3);
  1946.                                   write('Record Number ',statword2,'  ');
  1947.                                end;
  1948.             end;
  1949.          end;
  1950.  
  1951.           
  1952.           
  1953.                                              -31-                                Examples
  1954.  
  1955.  
  1956.  
  1957.          Griffin Solutions
  1958.          ═════════════════
  1959.  
  1960.          begin
  1961.             ClrScr;
  1962.             Health.Init('HEALTH');
  1963.             Health.Open;
  1964.             Health.IndexTo('FOODCODE','FOOD_CODE');
  1965.                                              {Create an index.  Use field FOOD_CODE}
  1966.                                              {and create a .NDX file named FOODCODE}
  1967.             Health.Index('FOODCODE');        {Use Index FOODCODE.NDX}
  1968.             Health.GetRec(Top_Record);
  1969.             while not Health.File_EOF do
  1970.             begin
  1971.                writeln(Health.FieldGet('FOOD'),'   ',
  1972.                        Health.FieldGet('CALS'),'   (',
  1973.                        Health.FieldGet('FOOD_CODE'),')');
  1974.                Health.GetRec(Next_Record);
  1975.             end;
  1976.             Health.Close;
  1977.          end.
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984.  
  1985.  
  1986.  
  1987.  
  1988.  
  1989.  
  1990.  
  1991.  
  1992.  
  1993.  
  1994.  
  1995.  
  1996.  
  1997.  
  1998.  
  1999.  
  2000.  
  2001.  
  2002.  
  2003.  
  2004.  
  2005.  
  2006.  
  2007.  
  2008.  
  2009.  
  2010.  
  2011.  
  2012.  
  2013.  
  2014.  
  2015.  
  2016.          Examples                                -32-     
  2017.  
  2018.